// https://vitepress.dev/guide/custom-theme
import { h } from 'vue'
import type { Theme } from 'vitepress'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/dark/css-vars.css'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
// import zhCn from 'element-plus/dist/locale/zh-cn.mjs'; // 此处是element-plus汉化
import DefaultTheme from 'vitepress/theme'
import DevecouiPlus from "devecoui-plus"; //必须引入
import 'devecoui-plus/dist/style.css';
import 'devecoui-plus/web-types.json'
import {defaultConfig} from '../config/devecoui-plus/devecoui.config'; // 加一句这个（引入配置文件）
import {components} from '../components/index'; // 全局组件
import { enhanceAppWithDemos } from '../plugins/register-demos'
import './style.css'
// import HistoryLayout from './HistoryLayout.vue'

export default {
  extends: DefaultTheme,
  Layout: () => {
    return h(DefaultTheme.Layout, null, {
      // 'HistoryLayout': () => h(HistoryLayout)
      // https://vitepress.dev/guide/extending-default-theme#layout-slots
    })
  },
  enhanceApp({ app, router, siteData }) {
    app.use(ElementPlus, {locale: zhCn});
    // @ts-ignore
    app.use(DevecouiPlus,defaultConfig)
    components.forEach(([name, Comp]) => {
      app.component(name, Comp)
    })
    enhanceAppWithDemos(app)
  }
} satisfies Theme
